package com.tjsinfo.tjsoa.worklog.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.worklog.bo.IWorkLogMainBo;
import com.tjsinfo.tjsoa.worklog.vo.WorkLogMain;
public class SelectOneWorkLogAction extends Action{
	private IWorkLogMainBo workLogMainBo;
		
	
	

	public IWorkLogMainBo getWorkLogMainBo() {
		return workLogMainBo;
	}




	public void setWorkLogMainBo(IWorkLogMainBo workLogMainBo) {
		this.workLogMainBo = workLogMainBo;
	}




	/* (non-Javadoc)
	 * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
		String id = request.getParameter("id");
		WorkLogMain   workLogMain =  workLogMainBo.selectWorkLogMainAndExamine(id);
		request.setAttribute("plan", workLogMain);
		if ("Y".equals(workLogMain.getType()) ) {
			return mapping.findForward("year");
		} else {
			return mapping.findForward("ok");
		}
		
	}
}
